using System;

namespace Gebra
{
    public class Variable : Operand
    {
        private Operand _value = new None();

        /// <summary>
        /// Set the value of the variable.
        /// </summary>
        /// <param name="a_value">Value.</param>
        /// <exception cref="ArgumentNullException">Thrown if "<paramref name="a_value"/>" is null.</exception>
        public void SetValue(Operand a_value)
        {
            #region Argument Validation

            if (a_value == null)
                throw new ArgumentNullException("a_value");

            #endregion

            _value = a_value;
        }

        /// <summary>
        /// Evaluate this operand.
        /// </summary>
        /// <returns>Result of evaluation.</returns>
        public override Operand Evaluate()
        {
            return _value;
        }
    }
}